import request from '../utils/request'


// CommodityController

// 向后端传送数据添加商品sku
export function addComm(data) {
    return request.post(`/commodity`, data);
}

//添加图片
// [HttpPost, Route("picture/{id}")]
export function addCommPicture(id, file) {
    return request.post(`/commodity/picture/${id}`, file, { "Content-Type": " multipart/form-data" });
}

//删除图片
export function deleteCommPicture(id) {
    return request.delete(`/commodity/${id}`);
}

//商品查找所有商品
// [HttpGet,Route("commspu/{id}")]
export function gteCommspu(id) {
    return request.get(`/commodity/commspu/${id}`);
}

//添加spu
// [HttpPost, Route("commspu")]

export function addCommspu(data) {
    return request.post(`/commodity/commspu`, data);
}

//删除商品
// [HttpPost, Route("delete/{id}")]
export function deleteCommspu(id) {
    return request.post(`/commodity/delete/${id}`);
}



// 上传文章图片
export function addPicture(file){
    return request.post(`picture`,file,{"Content-Type":" multipart/form-data"});
}

//删除文章图片
export function deletePicture(file){
    return request.put(`picture`,file);
}
//添加商品内容
// [HttpPost, Route("content/{id}")]
export function addCommCont(id,data){
    return request.post(`/commodity/content/${id}`,data);
}